package com.study.graph.controller;

import com.study.graph.model.NebulaResult;
import com.study.graph.repository.PersonRepository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class TestController {

    @Resource
    PersonRepository nebulaTemplate;

    @GetMapping("/addVertex")
    public Object addJSON() {
        String sql = "insert vertex team(team_name, persion_num) values \"team_2\":(\"team_2\", 43);";
        NebulaResult nebulaResult = nebulaTemplate.executeObject(sql);
        return nebulaResult;
    }

//    @GetMapping("/findVertex")
//    public Object findJson2() {
//        String sql = "lookup on team  yield id(vertex) AS id,properties(vertex).persion_num AS persion_num,properties(vertex).team_name AS team_name;";
//        NebulaResult<Info> infoNebulaResult = nebulaTemplate.queryObject(sql, Info.class);
//        return infoNebulaResult;
//    }
}